﻿-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
USE [WarehouseManagement]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		AnhDQ
-- Create date: 3/22/2011
-- Description:	This stored procedure use to undelete an Contact record
-- =============================================
ALTER PROCEDURE [UndoDeletedContact]
(
@ContactID INT
)
AS
BEGIN
	IF (EXISTS (SELECT 1 FROm [Contact] WHERE [ContactID] = @ContactID AND [IsDelete] = 1))
	BEGIN
		UPDATE 
				Contact 
		SET 
				IsDelete = 0
		WHERE 
				ContactID = @ContactID
	END
END

/*
USE WarehouseManagement
GO

EXEC [UndoDeletedContact] 4
*/